package com.cn.controller;

import com.cn.domain.UserDetail;
import com.cn.service.UserService;
import com.cn.utils.ResultCode;
import com.cn.vo.ReJson;
import com.cn.vo.UserAndTokenVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by chenyuncong on 2019/9/16.
 */
@RestController
@Api("用户模块")
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("refresh")
    @ApiOperation(value="刷新token值")
    public ReJson<UserAndTokenVo> refresh(String oldToken){
        return new ReJson(userService.refresh(oldToken));
    }

    //根据token获取user对象
    @PostMapping("getUserByToken")
    public UserDetail getUserByToken(String token){

        return null;
    }
}
